#ifndef GOOD_H
#define GOOD_H
#include <fstream>
#include <iomanip>
#include <iostream>
#include <ostream>
#include <string>
class Server;
class Interface;
class cart;
class User;
class good {
  friend class Server;
  friend class Interface;
  friend class cart;
  friend class User;
public:
  good() : id(-1), name(), brand(), price(-1), quantity(-1), owner() {}
  good(short id, std::string name, std::string brand, double price,
       int quantity, std::string owner)
      : id(id), name(name), brand(brand), price(price), quantity(quantity),
        owner(owner) {}
  friend std::ostream &operator<<(std::ostream &os, good g);
  bool operator==(const good &ot);
  void to_file(std::ofstream &fs);
  void from_file(std::ifstream &fs);
  void from_stringstream(std::istringstream& fs);
  friend std::istream &operator>>(std::istream &is, good& g);

private:
  short id;
  std::string name;
  std::string brand;
  double price;
  int quantity;
  std::string owner;
};
#endif